package cn.always.xiajia.admin.client.api.sys.dto;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Schema(description = "管理后台-登录中心 Request 参数")
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true) // set返回对象
public class AuthLoginReqVO {

	// RequiredMode 必填
	@Schema(description = "账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "test")
	@NotEmpty(message = "登录账号不能为空")
	@Length(min = 4, max = 16, message = "账号长度为 4-16 位")
	@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
	private String userCode;

	@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmW")
	@NotEmpty(message = "密码不能为空")
	private String password;

	// ========== 图片验证码相关 ==========
	@Schema(description = "验证码，验证码开启时，需要传递", requiredMode = Schema.RequiredMode.REQUIRED, example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==")
	@NotEmpty(message = "验证码不能为空", groups = CodeEnableGroup.class)
	private String captchaVerification;

	/**
	 * 开启验证码的 Group
	 */
	public interface CodeEnableGroup {
	}
}